import BaseCURDV2Api from '@/framework/infra/base/BaseCURDV2Api'

class ProductOfflineRegisterApi extends BaseCURDV2Api {
  constructor() {
    super('pdt/product-offline-register')
  }

  exchangeFollow(ids) {
    return this.post('/exchange-follow', { ids })
  }

  countInfo() {
    return this.get('/count-info')
  }

  myCountInfo() {
    return this.get('/my-count-info')
  }

  myListPage(params) {
    const getParams = { ...params }
    Object.keys(getParams).forEach(key => {
      if (Array.isArray(getParams[key])) {
        getParams[key] = getParams[key].join(',')
      }
    })
    return this.get('my-list-page', getParams)
  }

  offlineHandle(ids) {
    return this.post('/offline-handle', { ids })
  }

  distribution(data) {
    return this.post('/distribution', data)
  }

  distributionBackend(data) {
    return this.post('/distribution-backend', data)
  }

}

export const productOfflineRegisterApi = new ProductOfflineRegisterApi()
